package com.lifang.test4;

import com.lifang.framework.context.support.AnnotationConfigApplicationContext;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

@Slf4j
public class TestApp {

    /**
     * aop + ioc + 循环依赖 + 基本生命周期，Aware感知，初始化 销毁方法
     */
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(TestApp.class);
        Map<String, UserService> beansOfType = applicationContext.getBeansOfType(UserService.class);
        for (Map.Entry<String, UserService> entry : beansOfType.entrySet()) {
            UserService value = entry.getValue();
            value.sayHello("张三");
            log.info(value.sayHelloReturn("张三"));
            value.buildError("张三");
        }
    }

}
